home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir41 / ucpbtm10.zip / UCOMPBTM.DOC < prev   
Text File  |  1993-12-23  |  4KB  |  91 lines

  1.                    UCOMPBTM 4dos compressed .BTM decompressor
  2.                       Copyright (C) 1933 Christopher Hall
  3.  
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8.  
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. GNU General Public License for more details.
  13.  
  14. You should have received a copy of the GNU General Public License
  15. along with this program, as the file COPYING.DOC; if not, write to the
  16. Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. I may be contacted by e-mail as cah17@phx.cam.ac.uk, or by paper mail at
  19. Christ's College, Cambridge, CB2 3BU, England
  20.  
  21.  
  22. What is UCOMPBTM?
  23. ~~~~~~~~~~~~~~~~~
  24. UCOMPBTM is a program to decompress compressed .BTM batch files made by 4dos
  25. version 5.0 and above.  4dos is a commercial replacement for COMMAND.COM made
  26. by JP Software Inc.  As of version 5, it has had an option to compress its
  27. batch files, using the BATCOMP external program supplied with 4dos.  However,
  28. no way of decompressing these files is provided, which would normally mean
  29. wasting any disk space you would otherwise have saved, on storing the original
  30. file.  This program solves that problem.
  31.  
  32. Usage
  33. ~~~~~
  34. UCOMPBTM has a very similar syntax to BATCOMP, and is designed to work in as
  35. similar a way as possible, while still providing full functionality.  The full
  36. syntax is
  37.  
  38.   UCOMPBTM [[/O] input-file [output-file]]
  39.  
  40. where the square brackets denote optional items.
  41.  
  42. If no parameters are specified, then UCOMPBTM will decompress standard input,
  43. and write the result to standard output.  Copyright and status messages are
  44. printed to the error output, so that they won't interfere with the output file.
  45. If you're running UCOMPBTM under 4dos, then you can use >&>NUL to dispose of
  46. this output.  This option is provided so that you can view a compressed file
  47. without having to make a permanent decompressed copy.  For example, use the
  48. command
  49.  
  50.   UCOMPBTM < comprssd.btm | more
  51.  
  52. to view the uncompressed source for comprssd.btm.
  53.  
  54. The other way of using UCOMPBTM is the same as the way BATCOMP is used.  Here,
  55. the input file is compressed, and written to the output file.  If no output
  56. file is specified, then the input filename will be used, but with its extension
  57. changed to .BAT.  The /O switch allows overwriting of an existing file.  Note
  58. that, as with BATCOMP, wildcards are not allowed.  For this, you should
  59. probably use the FOR command.
  60.  
  61. Compressed file format
  62. ~~~~~~~~~~~~~~~~~~~~~~
  63. The format of compressed files is quite simple.
  64.  
  65. To start with, there's a 2 byte header, which should consist of the bytes EB
  66. and BE (in hex).  This is the signal to 4dos that it's dealing with a
  67. compressed file.
  68.  
  69. Then comes the number of characters in the original file, where line breaks are
  70. treated as just one character.
  71.  
  72. Next, come the 30 most used characters in the original batch file, where line
  73. breaks are treated as just an 0D.  Number these from 02 to 1F.  (This numbering
  74. will make sense later).  If there aren't this many distinct characters in
  75. the file, anything can go in the remaining slots.
  76.  
  77. Now comes the compressed data itself.  This consists of a series of nibbles (4
  78. bits, or one hex digit), with the high nibble in each byte being dealt with
  79. first.  This is interpreted as follows:
  80. - A nibble of 0 means that the next 2 nibbles are the low and high nibbles
  81.   (respectively) of the next uncompressed byte.  This is used if the character
  82.   isn't one of the most common 30.  Again, 0D stands for 0D,0A as a line break.
  83. - A nibble of 1 means that the next nibble will be added to 10 (hex) to create
  84.   the number of a common character from 10 to 1F
  85. - A nibble of 2 to F is one of the 14 most common characters, numbers 2 to F in
  86.   the table.
  87.  
  88. This repeats until the end of the file, with a 0 being used to pad at the end
  89. if an odd number of nibbles is needed.  The length word is another way of
  90. detecting this situation.
  91.